<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>simHandleProximitySensor</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
</head>

<body>

<div align="center">
<table class=allEncompassingTable >
 <tr>
  <td >
<p><a href="../../index.html" TARGET="_top"><img src="../images/homeImg.png"></a></p>

<h1>Regular API function</h1>
<h3 class=subsectionBar><a name="simHandleProximitySensor" id="simHandleProximitySensor"></a>simHandleProximitySensor / sim.handleProximitySensor </h3>
<table class=apiTable>
<tr class=apiTableTr> 
<td class=apiTableLeftDescr>
Description 
</td> 
<td class=apiTableRightDescr>Handles (performs sensing, etc. of) a registered proximity sensor object. See also <a href="simReadProximitySensor.htm">sim.readProximitySensor</a>, <a href="simCheckProximitySensor.htm">sim.checkProximitySensor</a>, <a href="simCheckProximitySensorEx.htm">sim.checkProximitySensorEx</a> and <a href="simResetProximitySensor.htm">sim.resetProximitySensor</a>.<br></td>
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCSyn>
C synopsis
</td> 
<td class=apiTableRightCSyn>simInt simHandleProximitySensor(simInt sensorHandle,simFloat* detectedPoint,simInt* detectedObjectHandle,simFloat* detectedSurfaceNormalVector)<br></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCParam>C parameters</td> 
<td class=apiTableRightCParam>
<div><strong>sensorHandle</strong>: handle of a proximity sensor object or sim_handle_all or sim_handle_all_except_explicit. (sim_handle_all will handle all proximity sensor objects, while sim_handle_all_except_explicit will only handle those that are not marked as &quot;explicit handling&quot;)<br>
</div>
<div><strong>detectedPoint</strong>: coordinates of the closest detected point (x, y and z: detectedPoint[0]-detectedPoint[2]) relative to the sensor reference frame, and distance to the detected point (1 value: detectedPoint[3]). Can be nullptr<br>
</div>
<div><strong>detectedObjectHandle</strong>: handle of the object that was detected. Can be nullptr<br>
</div>
<div><strong>detectedSurfaceNormalVector</strong>: normal vector (normalized) of the detected surface. Relative to the sensor reference frame. Can be nullptr<br>
</div>
<br>
<div>When several proximity sensors are handled at the same time (e.g. with the sim_handle_all argument), then the output values are relative to the closest detection distance</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCRet>
C return value
</td> 
<td class=apiTableRightCRet>
<div>0 if nothing was detected, -1 in case of an error. <br>
</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLSyn>
Lua synopsis
</td> 
<td class=apiTableRightLSyn>int result,float distance,table[3] detectedPoint,int detectedObjectHandle,table[3] detectedSurfaceNormalVector=sim.handleProximitySensor(int sensorHandle)<br></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLParam>Lua parameters</td> 
<td class=apiTableRightLParam>
<div><strong>sensorHandle</strong>: handle of a proximity sensor object or sim.handle_all or sim_handle_all_except_explicit. (sim.handle_all will handle all proximity sensor objects, while sim.handle_all_except_explicit will only handle those that are not marked as &quot;explicit handling&quot;)</div></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLRet>
Lua return values
</td> 
<td class=apiTableRightLRet>
<div><strong>result</strong>: 0 if nothing was detected<br>
</div>
<div><strong>distance</strong>: distance to the detected point<br>
</div>
<div><strong>detectedPoint</strong>: table of 3 numbers indicating the relative coordinates of the detected point<br>
</div>
<div><strong>detectedObjectHandle</strong>: handle of the object that was detected<br>
</div>
<div><strong>detectedSurfaceNormalVector</strong>: normal vector (normalized) of the detected surface. Relative to the sensor reference frame.<br>
</div>
<br>
<div>When several proximity sensors are handled at the same time (e.g. with the sim.handle_all argument), then the return values are relative to the closest detection distance</div>
</td> 
</tr> 
</table> 


<br>
</td>
</tr>
</table>
</div>
</body>
</html>
